package com.bootdo.acitvity.DDD.domain.entity;

public class ShareStock extends Stock{

    public ShareStock(Long stockAmount){
        super(stockAmount);
    }

    @Override
    public ShareStock reduce(Stock stock) {
        return new ShareStock(this.getStockAmount() - stock.getStockAmount());
    }

    @Override
    public ShareStock add(Stock stock) {
        return new ShareStock(this.getStockAmount() + stock.getStockAmount());
    }

    public boolean isSharedStockEnough(ShareStock shareStock, Stock stockChange) {
        if (shareStock.compareTo(stockChange) >= 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public String toString(){
        return String.valueOf(getStockAmount());
    }
}
